package com.example.demo.repository.dao;

import com.example.demo.entity.Consultant;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Repository
@Transactional
public interface ConsultantDao extends JpaRepository<Consultant, String>, JpaSpecificationExecutor<Consultant> {
    Consultant getConsultantByPhoneNumber(String phoneNumber);

    Integer deleteConsultantByPhoneNumber(String phoneNumber);

    /**
     * 返回 isSupervisor 字段等于 val的Consultant所组成的列表。
     * @param val String ("true" | "false")
     * @return List<Consultant></>
     */
    List<Consultant> findAllByIsSupervisor(String val);
}
